package com.github.cyf.interceptor.page.dialect.impl;

import com.github.cyf.interceptor.page.dialect.Dialect;

/**
 * 简单实现将 sql 转换为分页语句和总数语句
 * @author chenyifan
 * @create 2024-04-13 20:53
 */
public class MySqlDialect implements Dialect {

    @Override
    public String getPageSql(String sql) {
        return sql + " LIMIT ? , ?";
    }

    @Override
    public String getCountSql(String sql) {
        return "SELECT COUNT(1) FROM (" + sql + ") AS count_temp";
    }
}